<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
      function isToday(str) {
        if (new Date(str).toDateString() === new Date().toDateString()) {
        //今天
        console.log("当天");
    } else if (new Date(str) < new Date()){
        //之前
        console.log("以前的日期");
    }
}
  let str = 1640229348000
     isToday(str)
    </script>
</body>

</html>